package com.foreknow.demo11;

public class StringDemo {
    public static void main(String[] args) {
        String name = "fender";
        String newName = name.concat(" custom shop"); //将指定字符串连接到此字符串的结尾。
        System.out.println(newName.length()); //返回此字符串的长度。
        System.out.println( "hamburger".substring(4, 8)); //截取子串 从beginIndex开始到endIndex-1结束
        System.out.println("smiles".substring(1, 5));
        System.out.println("unhappy".substring(2));
        System.out.println("gibson".toUpperCase());//转换大写
        System.out.println("YAMAHA".toLowerCase());//转换小写
        System.out.println("          abc          ".trim()); //去掉首尾空格
        String reg = "aa bb cc";
        String[] result = reg.split(" "); //拆分字符串
        for(int i = 0;i<result.length;i++) {
            System.out.println(result[i]);
        }
    }
}
